﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

using H2.NET.Business;

namespace H2.NET.Web.Pages
{
    public partial class Technical : TaskControl
    {
        #region 属性 Public
        public string FORM
        {
            get
            {
                return (Parent as TabMaterial).Status.FORM;
            }
        }

        public string Category
        {
            get
            {
                return (Parent as TabMaterial).Status.Category;
            }
        }

        public string Action
        {
            get
            {
                return (Parent as TabMaterial).Status.Technical;
            }
        }

        private bool IsLoaded
        {
            get
            {
                return ViewState["IsLoaded"] == null ? false : (bool)ViewState["IsLoaded"];
            }
            set { ViewState["IsLoaded"] = value; }
        }

        private bool IsUsed
        {
            get
            {
                //return !(string.IsNullOrEmpty(FORM) || string.IsNullOrEmpty(Action)
                //        || (FORM != "FORM-005" && FORM != "FORM-009" && FORM != "FORM-012" && FORM != "FORM-062" && FORM != "FORM-064" && FORM != "FORM-035" && FORM != "FORM-036" && FORM != "FORM-043" && FORM != "FORM-074"));

                return !string.IsNullOrEmpty(Action);
            }
        }
        #endregion

        #region 事件 页面加载
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Visible = IsUsed;
        }
        #endregion

        #region 事件 Inspection_Setup
        protected void TEC_Inspection_Setup_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (Category)
            {
                case "SEFI":
                    //TEC_Insp_Type.Items.Clear();
                    //if (TEC_Inspection_Setup.SelectedValue == "Y")
                    //{
                    //    TEC_Insp_Type.Items.Add(new ListItem("04", "04"));
                    //    TEC_Insp_Type.SelectedIndex = 0;
                    //}
                    //else
                    //{
                    //    TEC_Insp_Type.Items.Add(new ListItem("", ""));
                    //}
                    TEC_Insp_Type.SelectedValue = TEC_Inspection_Setup.SelectedValue == "Y" ? "04" : "";
                    break;

                case "RAW":
                    //TEC_Insp_Type.Items.Clear();
                    //if (TEC_Inspection_Setup.SelectedValue == "Y")
                    //{
                    //    TEC_Insp_Type.Items.Add(new ListItem("01", "01"));

                    //}
                    //else
                    //{
                    //    TEC_Insp_Type.Items.Add(new ListItem("", ""));
                    //}
                     TEC_Insp_Type.SelectedValue = TEC_Inspection_Setup.SelectedValue == "Y" ? "01" : "";
                    break;
            }
        }
        #endregion
         
        #region 事件 Density
        protected void TEC_Density_TextChanged(object sender, EventArgs e)
        {
            switch (Category)
            {
                case "SEFI":
                case "RAW":
                    double density = 0.0;
                    double.TryParse(TEC_Density.Text, out density);
                    TEC_Unit_Of_Measure_Y.Text = (1000 * density).ToString();
                    break;
            }
            if (TaskAPI.Process == "NPL Master Data Application")
            {
                double tmpD = 0;
                if (double.TryParse(TEC_Density.Text, out tmpD)) TEC_Density.Text = (Convert.ToDouble(Convert.ToInt32(Convert.ToDouble(TEC_Density.Text) * 1000)) / 1000).ToString();
            }
        }
        #endregion

        #region 事件 A_Coat
        protected void TEC_A_Coat_TextChanged(object sender, EventArgs e)
        {
            m_MaterialGroup mg = (m_MaterialGroup.material_group == (TEC_A_Coat.Text.Length > 2 ? TEC_A_Coat.Text.Substring(0, 2) : TEC_A_Coat.Text)).ListFirst<m_MaterialGroup>();
            if (mg != null)
            {
                TEC_Material_Group.Text = mg.Material_Group + ", " + mg.Description;
            }
            else
            {
                TEC_Material_Group.Text = "A" + (TEC_A_Coat.Text.Length > 2 ? TEC_A_Coat.Text.Substring(0, 2) : TEC_A_Coat.Text);
            }
        }
        #endregion

        #region 方法 InitControls(初始化)
        public void InitControls(mdc_Material mt)
         {
            //如果当前 Tabs 是隐藏的情况，退出
            Visible = IsUsed;
            if (!IsUsed)
            {
                return;
            }

            InitShowHide();

            if (!IsLoaded)
            {
                InitDropDownList();
            }
  
            Distribute(mt);

            if (TaskAPI.Process == "TW NPL Application-PKG" || TaskAPI.Process == "TW NPL Application-DECO" || TaskAPI.Process == "TW New Raw Material Creation" || TaskAPI.Process == "TW Pack Material Maintenance")
            {
                this.TEC_Material_Group.Dialog_ID = "TW-0012";
            }
            if (TaskAPI.Process == "TW FINI Code Application")
            {
                this.TEC_Material_Group.Dialog_ID = "TW-0011";
            }
            SetForeColor(Color.Black,TEC_Relabel_L, TEC_Recipe_Number_L, TEC_MSDS_EN_L, TEC_MSDS_CN_L,TEC_Lab_Office_1_L, TEC_Volume_Unit_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Size_dimension_L, TEC_Unit_Of_Measure_Y_L, TEC_Volume_L, TEC_Material_Group_L, TEC_Top_Sefi_L, TEC_Unit_Of_Measure_Y_L, TEC_Material_Group_L, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_Division_L, TEC_SEFI_Code_L, TEC_Remark_L, TEC_MTO_Code_SEFI_Code_L, TEC_Color_Code_L, TEC_Top_Sefi_L, TEC_Base_Unit_Of_Measure_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Material_Group_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_GenItemCatGroup_L, TEC_Subline_L, TEC_Pack_Size_L, TEC_QM_L, TEC_Active_L, TEC_Volume_L, TEC_Net_Weight_L);

            if (TaskAPI.IsAllowSubmit)
            {
                switch (Action)
                {
                    case "C":
                        SetEnable(true, TEC_Relabel,TEC_Size_dimension, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_Division, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup, TEC_Subline, TEC_Pack_Size, TEC_QM, TEC_Active, TEC_Color_Code, TEC_Volume, TEC_Volume_Unit, TEC_Net_Weight);
                        SetForeColor(Color.Blue, TEC_Relabel_L,TEC_Lab_Office_1_L, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_SEFI_Code_L, TEC_MTO_Code_SEFI_Code_L, TEC_Top_Sefi_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Subline_L, TEC_Pack_Size_L, TEC_QM_L, TEC_Active_L, TEC_Color_Code_L, TEC_Volume_L, TEC_Net_Weight_L);
                        if (FORM == "FORM-005")
                        {
                            SetEnable(true, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_Division, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup);
                            SetForeColor(Color.Blue, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_SEFI_Code_L, TEC_MTO_Code_SEFI_Code_L, TEC_Top_Sefi_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L);
                            SetForeColor(Color.Black, TEC_Color_Code_L);
                        }
                        if (FORM == "FORM-031" && (Parent as TabMaterial).Status.KeyWord == "MM2")
                        {
                            SetForeColor(Color.Black, TEC_Density_L);
                        }
                        if (FORM == "FORM-012" && (Parent as TabMaterial).Status.KeyWord == "MM1" && (Page as PMDC).Distribute.SelectedValue == "LF")
                        {
                            SetEnable(true, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_Division, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Color_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup, TEC_Subline, TEC_Pack_Size, TEC_QM, TEC_Active);
                            SetForeColor(Color.Blue, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_SEFI_Code_L, TEC_MTO_Code_SEFI_Code_L, TEC_Color_Code_L, TEC_Top_Sefi_L, TEC_Inspection_Setup_L, TEC_Subline_L, TEC_Pack_Size_L, TEC_QM_L, TEC_Active_L);
                            SetForeColor(Color.Black, TEC_SAP_IP_Group_L);
                        }
                        if (FORM == "FORM-062")
                        {
                            SetForeColor(Color.Blue, TEC_Density_L);
                        }
                        if (FORM == "FORM-TW-003")
                        {
                            SetForeColor(Color.Blue, TEC_Volume_L, TEC_Material_Group_L, TEC_Unit_Of_Measure_Y_L,TEC_Storage_Location_L);
                        }
                        if (FORM == "FORM-TW-011")
                        {
                            SetForeColor(Color.Blue, TEC_Volume_L,TEC_Top_Sefi_L,TEC_Unit_Of_Measure_Y_L,TEC_Profit_Center_L);
                        }
                        if (FORM == "FORM-TW-004")
                        {
                            SetForeColor(Color.Blue, TEC_Material_Group_L, TEC_Volume_L);
                            SetForeColor(Color.Black, TEC_SEFI_Code_L,TEC_Lab_Office_L);
                        }
                        if (FORM == "FORM-TW-007-1")
                        {
                            SetForeColor(Color.Blue, TEC_Volume_L, TEC_Unit_Of_Measure_Y_L);
                        }
                        if (FORM == "FORM-T008")
                        {
                            SetForeColor(Color.Blue, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_SEFI_Code_L, TEC_Volume_L, TEC_Top_Sefi_L);
                        }
                        if (FORM == "FORM-T011")
                        {
                            SetForeColor(Color.Blue, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_SEFI_Code_L, TEC_Volume_L, TEC_Top_Sefi_L);
                        }
                        if (FORM == "FORM-T003")
                        {
                            SetForeColor(Color.Blue,TEC_Active_L);
                            SetForeColor(Color.Black, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_Volume_L, TEC_Total_Shelf_life_L);
                        }
                        if (FORM == "FORM-T007")
                        {
                            SetForeColor(Color.Blue, TEC_Top_Sefi_L, TEC_SEFI_Code_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Volume_L);
                           // SetForeColor(Color.Black, TEC_SEFI_Code_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Density_L, TEC_Volume_L);
                        }
                        if (FORM == "FORM-T011-1")
                        {
                            //SetForeColor(Color.Black, TEC_Top_Sefi_L);
                            SetForeColor(Color.Blue,TEC_Top_Sefi_L, TEC_SEFI_Code_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Density_L, TEC_Volume_L);
                        }
                        SetDefaultValue();
                        break;
                    case "S":
                        SetEnable(false, TEC_Relabel,TEC_Recipe_Number, TEC_MSDS_EN, TEC_MSDS_CN, TEC_Storage_Location, TEC_Total_Shelf_life, TEC_Size_dimension, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Color_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup, TEC_Subline, TEC_Pack_Size, TEC_QM, TEC_Active, TEC_Volume, TEC_Volume_Unit, TEC_Net_Weight);
                        SetDefaultValue();
                        SetForeColor(Color.Black, TEC_Relabel_L,TEC_Recipe_Number_L, TEC_MSDS_EN_L, TEC_MSDS_CN_L, TEC_Lab_Office_1_L, TEC_Volume_Unit_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Size_dimension_L, TEC_Unit_Of_Measure_Y_L, TEC_Volume_L, TEC_Material_Group_L, TEC_Top_Sefi_L, TEC_Unit_Of_Measure_Y_L, TEC_Material_Group_L, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_Division_L, TEC_SEFI_Code_L, TEC_Remark_L, TEC_MTO_Code_SEFI_Code_L, TEC_Color_Code_L, TEC_Top_Sefi_L, TEC_Base_Unit_Of_Measure_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Material_Group_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_GenItemCatGroup_L, TEC_Subline_L, TEC_Pack_Size_L, TEC_QM_L, TEC_Active_L, TEC_Volume_L, TEC_Net_Weight_L);
                    
                        break;
                    case "E":
                        SetEnable(true, TEC_Relabel,TEC_Recipe_Number, TEC_MSDS_EN, TEC_MSDS_CN, TEC_Storage_Location, TEC_Total_Shelf_life, TEC_Size_dimension, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Color_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup, TEC_Subline, TEC_Pack_Size, TEC_QM, TEC_Active, TEC_Volume, TEC_Volume_Unit, TEC_Net_Weight);
                        SetForeColor(Color.Black, TEC_Relabel_L,TEC_Recipe_Number_L, TEC_MSDS_EN_L, TEC_MSDS_CN_L, TEC_Unit_Of_Measure_Y_L, TEC_Volume_L, TEC_Material_Group_L, TEC_Top_Sefi_L, TEC_Unit_Of_Measure_Y_L, TEC_Material_Group_L, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_SEFI_Code_L, TEC_Remark_L, TEC_MTO_Code_SEFI_Code_L, TEC_Color_Code_L, TEC_Top_Sefi_L, TEC_Base_Unit_Of_Measure_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Material_Group_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_GenItemCatGroup_L, TEC_Subline_L, TEC_Pack_Size_L, TEC_QM_L, TEC_Active_L, TEC_Volume_L, TEC_Net_Weight_L);
                        SetDefaultValue();
                        break;
                }
            }
            else
            {
                SetEnable(false, TEC_Relabel,TEC_Storage_Location, TEC_Total_Shelf_life, TEC_Lab_Office_1, TEC_Net_Weight, TEC_Volume, TEC_Volume_Unit, TEC_Weight_Unit, TEC_Active, TEC_Size_dimension, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_Division, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Color_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup, TEC_Subline, TEC_Pack_Size);
            }
            
            IsLoaded = true;
        }
        #endregion

        #region 方法 InitDropdownList(初始化下拉框数据源)
        private void InitDropDownList()
        {            
            TEC_Plant.Items.Clear();
            TEC_Plant.Items.Add(new ListItem("", ""));
            IList<m_Plant> dlts = (m_Plant.status == 1 & m_Plant.categary == "P").List<m_Plant>();
            foreach (m_Plant dlt in dlts)
            {
                TEC_Plant.Items.Add(new ListItem(dlt.PlantName, dlt.PlantName));
            }

            TEC_Lab_Office.Items.Clear();
            TEC_Lab_Office.Items.Add(new ListItem("", ""));
            switch(Category)
            {
                case "RAW":
                case "PACK":
                case "ADVE":
                case "SEFI":
                    TEC_Lab_Office.Items.Add(new ListItem("KAA, All Emulsion", "KAA"));
                    TEC_Lab_Office.Items.Add(new ListItem("KAF, All HPC", "KAF"));
                    TEC_Lab_Office.Items.Add(new ListItem("KAI, All WC", "KAI"));
                    TEC_Lab_Office.Items.Add(new ListItem("KAQ, All PRE-DECO", "KAQ"));
                    TEC_Lab_Office.Items.Add(new ListItem("KAU, PKG-Packaging", "KAU"));
                    break;

                case "TRADE":
                    TEC_Lab_Office.Items.Add(new ListItem("KAO, OC-Premium FINI", "KAI"));
                    TEC_Lab_Office.Items.Add(new ListItem("KAP, OC-Mid Tier FINI", "KAP"));
                    TEC_Lab_Office.Items.Add(new ListItem("KAQ, PRE-DECO--Premium FINI", "KAQ"));
                    break;
            }
            if (FORM == "FORM-TW-011")
            {
                TEC_Profit_Center.Items.Clear();
                TEC_Profit_Center.Items.Add(new ListItem("", ""));
                TEC_Profit_Center.Items.Add(new ListItem("P4239001", "Local"));
                TEC_Profit_Center.Items.Add(new ListItem("P4239002", "Export"));
                TEC_Profit_Center.Items.Add(new ListItem("P4239003", "Intercompany"));
            }    
        }
        #endregion

        #region 方法 InitShowHide(初始化控件显示)
        private void InitShowHide()
        {
            SetVisible(false, TEC_Relabel, TEC_Relabel_L,TEC_Recipe_Number, TEC_Recipe_Number_L, TEC_MSDS_EN, TEC_MSDS_EN_L, TEC_MSDS_CN, TEC_MSDS_CN_L, TEC_Size_dimension, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_Division, TEC_SEFI_Code, TEC_Remark, TEC_MTO_Code_SEFI_Code, TEC_Color_Code, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_GenItemCatGroup, TEC_Subline, TEC_QM, TEC_Active, TEC_Pack_Size
                            , TEC_Lab_Office_1, TEC_Lab_Office_1_L,TEC_Size_dimension_L, TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_Division_L, TEC_SEFI_Code_L, TEC_Remark_L, TEC_MTO_Code_SEFI_Code_L, TEC_Color_Code_L, TEC_Top_Sefi_L, TEC_Base_Unit_Of_Measure_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Material_Group_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_GenItemCatGroup_L, TEC_Subline_L, TEC_QM_L, TEC_Active_L, TEC_Pack_Size_L
                            , TEC_Total_Shelf_life, TEC_Total_Shelf_life_L, TEC_Storage_Location, TEC_Storage_Location_L, TEC_Net_Weight, TEC_Net_Weight_L, TEC_Volume, TEC_Volume_L, TEC_Volume_Unit_L, TEC_Volume_Unit, TEC_Profit_Center_L, TEC_Profit_Center);

            switch (FORM)
            {
                case "FORM-005":
                    if (Category == "SEFI" && TaskAPI.Process != "NPL Master Data Application")
                    {
                        SetVisible(true, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_SEFI_Code, TEC_Remark, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit,TEC_Color_Code
                                       , TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_SEFI_Code_L, TEC_Remark_L, TEC_Top_Sefi_L, TEC_Base_Unit_Of_Measure_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L,TEC_Color_Code_L);
                        SetVisible(false, TEC_Subline, TEC_Pack_Size, TEC_Subline_L, TEC_Pack_Size_L);
                        if (TaskAPI.Process == "HK NPL Master Application")
                        {
                            SetVisible(false, TEC_Color_Code, TEC_Color_Code_L);
                        }
                        //if (TaskAPI.Process == "Sefi Code Applicaton")
                        //{
                        //    if ((Page as PMDC).Actions.SelectedValue == "Revision")
                        //    {
                        //        SetVisible(true, TEC_Color_Code, TEC_Color_Code_L);
                        //    }
                        //    else
                        //    {
                        //        SetVisible(false, TEC_Color_Code, TEC_Color_Code_L);
                        //    }
                        //}
                    }
                    else if ((Category == "SEFI") && TaskAPI.Process == "NPL Master Data Application")
                    {
                        SetVisible(true, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_SEFI_Code, TEC_Remark, TEC_Top_Sefi, TEC_Base_Unit_Of_Measure, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit
                                       , TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_SEFI_Code_L, TEC_Remark_L, TEC_Top_Sefi_L, TEC_Base_Unit_Of_Measure_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L);
                        SetVisible(false, TEC_Subline, TEC_Pack_Size, TEC_Subline_L, TEC_Pack_Size_L);
                    }
                    else if ((Category == "FINI") && TaskAPI.Process == "NPL Master Data Application")
                    {
                        SetVisible(true, TEC_Density, TEC_Density_L,TEC_Recipe_Number, TEC_Recipe_Number_L, TEC_MSDS_EN, TEC_MSDS_EN_L, TEC_MSDS_CN, TEC_MSDS_CN_L);
                    }
                    else
                    {
                        SetVisible(true, TEC_Density, TEC_Density_L);
                    }
                    break;
                case "FORM-009":
                    SetVisible(true, TEC_Plant, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Density, TEC_Division, TEC_Base_Unit_Of_Measure, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Material_Group, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_GenItemCatGroup
                                   , TEC_Plant_L, TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Density_L, TEC_Division_L, TEC_Base_Unit_Of_Measure_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Material_Group_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_GenItemCatGroup_L);
                    SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                    break;
                case "FORM-077":
                case "FORM-012":
                case "FORM-074":
                //case "FORM-062":
                case "FORM-064":
                    if (FORM == "FORM-062" || FORM == "FORM-064" || FORM == "FORM-074")     //Form-062 HK Fini code  NPL V2.0 100925 && Form-064 HK Trade Code V2.0 100925.xls
                    {
                        TEC_Title.Text = "&nbsp;";
                    }

                    if (Category == "SEFI")
                    {
                        //zph 新增
                        if (TaskAPI.Process == "MTO Base Code Application")
                        {
                            SetVisible(true, TEC_Relabel, TEC_Relabel_L,TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Division, TEC_MTO_Code_SEFI_Code, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_Subline, TEC_Density, TEC_Color_Code, TEC_Pack_Size
                                           , TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Division_L, TEC_MTO_Code_SEFI_Code_L, TEC_Base_Unit_Of_Measure_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_Subline_L, TEC_Density_L, TEC_Color_Code_L, TEC_Pack_Size_L);
                        }
                        //

                        else
                        {
                            SetVisible(true, TEC_Description_EN, TEC_Description_ZH, TEC_Lab_Office, TEC_Division, TEC_MTO_Code_SEFI_Code, TEC_Base_Unit_Of_Measure, TEC_SAP_IP_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Gross_Weight, TEC_Weight_Unit, TEC_Subline, TEC_Density, TEC_Color_Code, TEC_Pack_Size
                                           , TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Lab_Office_L, TEC_Division_L, TEC_MTO_Code_SEFI_Code_L, TEC_Base_Unit_Of_Measure_L, TEC_SAP_IP_Group_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_Subline_L, TEC_Density_L, TEC_Color_Code_L, TEC_Pack_Size_L);
                        }


                    }
                    else
                    {
                        SetVisible(true, TEC_Density, TEC_Color_Code, TEC_Density_L, TEC_Color_Code_L);
                        SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                    }

                    if (FORM == "FORM-074")
                    {
                        SetVisible(false, TEC_Color_Code, TEC_Color_Code_L);
                    }

                    break;

                case "FORM-035":
                    TEC_Title.Text = "&nbsp;";
                    SetVisible(true, TEC_SEFI_Code, TEC_Description_EN, TEC_Description_ZH, TEC_Base_Unit_Of_Measure, TEC_Gross_Weight, TEC_Density, TEC_Weight_Unit, TEC_Lab_Office, TEC_Top_Sefi, TEC_Insp_Type, TEC_Insp_Type, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Inspection_Setup
                                   , TEC_SEFI_Code_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Base_Unit_Of_Measure_L, TEC_Gross_Weight_L, TEC_Density_L, TEC_Weight_Unit_L, TEC_Lab_Office_L, TEC_Top_Sefi_L, TEC_Insp_Type_L, TEC_Insp_Type_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Inspection_Setup_L, TEC_Unit_Of_Measure_L);
                    SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                    break;
                case "FORM-036":
                    TEC_Title.Text = "&nbsp;";
                    SetVisible(true, TEC_A_Coat, TEC_Description_EN, TEC_Description_ZH, TEC_Material_Group, TEC_Plant, TEC_Lab_Office, TEC_Base_Unit_Of_Measure, TEC_Density, TEC_GenItemCatGroup, TEC_Division, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_Y, TEC_Insp_Type, TEC_Inspection_Setup
                                   , TEC_A_Coat_L, TEC_Description_EN_L, TEC_Description_ZH_L, TEC_Material_Group_L, TEC_Plant_L, TEC_Lab_Office_L, TEC_Base_Unit_Of_Measure_L, TEC_Density_L, TEC_GenItemCatGroup_L, TEC_Division_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_Y_L, TEC_Insp_Type_L, TEC_Inspection_Setup_L);
                    SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                    break;
                case "FORM-043":
                    TEC_Title.Text = "&nbsp;";
                    SetVisible(true, TEC_Insp_Type, TEC_Insp_Type_L);
                    break;
                case "FORM-031-1":
                    TEC_Title.Text = "&nbsp;";
                    SetVisible(true, TEC_Density, TEC_Density_L);
                    SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                    break;
                case "FORM-031-2":
                    TEC_Title.Text = "&nbsp;";
                    SetVisible(true, TEC_Density, TEC_Density_L);
                    SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                    break;
                case "FORM-062":
                    SetVisible(true, TEC_Density, TEC_Density_L);
                    break;
                case "FORM-010":
                    SetVisible(true, TEC_Density, TEC_Density_L);
                    break;
                case "FORM-TW-003":
                    SetVisible(true, TEC_A_Coat_L, TEC_A_Coat,TEC_Size_dimension, TEC_Size_dimension_L,TEC_Description_EN_L, TEC_Description_EN, TEC_Description_ZH_L, TEC_Description_ZH, TEC_Base_Unit_Of_Measure_L, TEC_Base_Unit_Of_Measure, TEC_Material_Group_L, TEC_Material_Group, TEC_Lab_Office_1_L, TEC_Lab_Office_1, TEC_Division_L, TEC_Division,
                         TEC_GenItemCatGroup_L, TEC_GenItemCatGroup, TEC_Active_L, TEC_Active, TEC_Insp_Type_L, TEC_Insp_Type, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y_L
                        , TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_Bun);
                    SetVisible(true, TEC_Volume_L, TEC_Volume, TEC_Gross_Weight_L, TEC_Gross_Weight, TEC_Net_Weight_L, TEC_Net_Weight, TEC_Weight_Unit_L, TEC_Weight_Unit, TEC_Volume_Unit_L, TEC_Volume_Unit);
                    SetVisible(true, TEC_Total_Shelf_life, TEC_Total_Shelf_life_L, TEC_Storage_Location, TEC_Storage_Location_L);
                    break;
                case "FORM-TW-011":
                    TEC_Description_ZH_L.Text="Description 2 (ZF.):";
                    TEC_SEFI_Code_L.Text = "SEFI Code(Old Material Code)";
                    SetVisible(true, TEC_SEFI_Code_L, TEC_SEFI_Code, TEC_Size_dimension, TEC_Size_dimension_L, TEC_Description_EN_L, TEC_Description_EN, TEC_Description_ZH_L, TEC_Description_ZH, TEC_Base_Unit_Of_Measure_L, TEC_Base_Unit_Of_Measure, TEC_Material_Group_L, TEC_Material_Group, TEC_Lab_Office_1_L, TEC_Lab_Office_1, TEC_Division_L, TEC_Division,
                         TEC_GenItemCatGroup_L, TEC_GenItemCatGroup,  TEC_Inspection_Setup_L,TEC_Inspection_Setup, TEC_Insp_Type_L, TEC_Insp_Type, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y_L
                        , TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_Bun, TEC_Top_Sefi_L, TEC_Top_Sefi);
                    SetVisible(true, TEC_Volume_L, TEC_Volume, TEC_Gross_Weight_L, TEC_Gross_Weight, TEC_Net_Weight_L, TEC_Net_Weight, TEC_Weight_Unit_L, TEC_Weight_Unit, TEC_Volume_Unit_L, TEC_Volume_Unit,TEC_Profit_Center_L,TEC_Profit_Center);
                    break;
                case "FORM-TW-004":
                    TEC_Title.Text = "Purchasing";
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_SEFI_Code_L.Text = "Old Material Number";
                    SetVisible(true, TEC_SEFI_Code_L, TEC_SEFI_Code, TEC_Size_dimension, TEC_Size_dimension_L, TEC_Description_EN_L, TEC_Description_EN, TEC_Description_ZH_L, TEC_Description_ZH, TEC_Base_Unit_Of_Measure_L, TEC_Base_Unit_Of_Measure, TEC_Material_Group_L, TEC_Material_Group, TEC_Lab_Office_1_L, TEC_Lab_Office_1, TEC_Division_L, TEC_Division,
                         TEC_GenItemCatGroup_L, TEC_GenItemCatGroup, TEC_Insp_Type_L, TEC_Insp_Type,TEC_Active,TEC_Active_L);
                    SetVisible(true, TEC_Volume_L, TEC_Volume, TEC_Gross_Weight_L, TEC_Gross_Weight, TEC_Net_Weight_L, TEC_Net_Weight, TEC_Weight_Unit_L, TEC_Weight_Unit, TEC_Volume_Unit_L, TEC_Volume_Unit);
                    break;
                case "FORM-TW-007-1":
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_SEFI_Code_L.Text = "SEFI Code(Old Material Code)";
                    SetVisible(true, TEC_SEFI_Code_L, TEC_SEFI_Code,  TEC_Base_Unit_Of_Measure_L,TEC_Base_Unit_Of_Measure, TEC_Description_EN_L, TEC_Description_EN, TEC_Description_ZH_L, TEC_Description_ZH,  TEC_Material_Group_L, TEC_Material_Group, TEC_Lab_Office_1_L, TEC_Lab_Office_1, TEC_Division_L, TEC_Division,
                         TEC_GenItemCatGroup_L, TEC_GenItemCatGroup,TEC_Inspection_Setup,TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Insp_Type,  TEC_Size_dimension,TEC_Size_dimension_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y_L
                        , TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_Bun, TEC_Top_Sefi_L, TEC_Top_Sefi);
                    SetVisible(true, TEC_Volume_L, TEC_Volume, TEC_Gross_Weight_L, TEC_Gross_Weight, TEC_Net_Weight_L, TEC_Net_Weight, TEC_Weight_Unit_L, TEC_Weight_Unit, TEC_Volume_Unit_L, TEC_Volume_Unit);
                    break;
                   
                //case "FORM-015"://TEC_Gross_Weight_L, TEC_Gross_Weight,
                //    TEC_Title.Text = "&nbsp;";
                //    SetVisible(true, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L,TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Bun);
                //    SetVisible(false, TEC_Pack_Size, TEC_Pack_Size_L);
                //    break;
                case "FORM-T008":
                    TEC_SEFI_Code_L.Text = "SEFI Code(Old Material Code)";
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                    TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                    TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                    TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                    SetVisible(true, TEC_SEFI_Code, TEC_SEFI_Code_L, TEC_Description_EN, TEC_Description_EN_L, TEC_Description_ZH, TEC_Description_ZH_L, TEC_Base_Unit_Of_Measure, TEC_Base_Unit_Of_Measure_L
                                   , TEC_Material_Group, TEC_Material_Group_L, TEC_Division, TEC_Division_L, TEC_Lab_Office_1, TEC_Lab_Office_1_L, TEC_Gross_Weight, TEC_Gross_Weight_L
                                   , TEC_GenItemCatGroup, TEC_GenItemCatGroup_L, TEC_Weight_Unit, TEC_Weight_Unit_L,TEC_Size_dimension, TEC_Size_dimension_L, TEC_Inspection_Setup, TEC_Inspection_Setup_L
                                   , TEC_Top_Sefi, TEC_Top_Sefi_L, TEC_Insp_Type, TEC_Insp_Type_L, TEC_Base_Unit_Of_Measure_L, TEC_Density, TEC_Density_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_X_L
                                   , TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_Bun_L
                                   , TEC_Net_Weight, TEC_Net_Weight_L, TEC_Volume, TEC_Volume_L, TEC_Unit_Of_Measure_L, TEC_Volume_Unit, TEC_Volume_Unit_L);

                    break;
                case "FORM-T011":
                    TEC_SEFI_Code_L.Text = "SEFI Code(Old Material Code)";
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                    TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                    TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                    TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                    SetVisible(true, TEC_SEFI_Code, TEC_SEFI_Code_L, TEC_Description_EN, TEC_Description_EN_L, TEC_Description_ZH, TEC_Description_ZH_L, TEC_Base_Unit_Of_Measure, TEC_Base_Unit_Of_Measure_L
                                   , TEC_Material_Group, TEC_Material_Group_L, TEC_Division, TEC_Division_L, TEC_Lab_Office_1, TEC_Lab_Office_1_L, TEC_Gross_Weight, TEC_Gross_Weight_L
                                   , TEC_GenItemCatGroup, TEC_GenItemCatGroup_L, TEC_Weight_Unit, TEC_Weight_Unit_L, TEC_Size_dimension, TEC_Size_dimension_L, TEC_Inspection_Setup, TEC_Inspection_Setup_L
                                   , TEC_Top_Sefi, TEC_Top_Sefi_L, TEC_Insp_Type, TEC_Insp_Type_L, TEC_Base_Unit_Of_Measure_L, TEC_Density, TEC_Density_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_X_L
                                   , TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_Bun_L
                                   , TEC_Net_Weight, TEC_Net_Weight_L, TEC_Volume, TEC_Volume_L, TEC_Unit_Of_Measure_L, TEC_Volume_Unit, TEC_Volume_Unit_L);
                    break;
                case "FORM-T011-1":
                    TEC_SEFI_Code_L.Text = "SEFI Code(Old Material Code)";
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                    TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                    TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                    TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                    SetVisible(true, TEC_SEFI_Code, TEC_SEFI_Code_L, TEC_Description_EN, TEC_Description_EN_L, TEC_Description_ZH, TEC_Description_ZH_L, TEC_Base_Unit_Of_Measure, TEC_Base_Unit_Of_Measure_L
                                   , TEC_Material_Group, TEC_Material_Group_L, TEC_Division, TEC_Division_L, TEC_Lab_Office_1, TEC_Lab_Office_1_L, TEC_Gross_Weight, TEC_Gross_Weight_L
                                   , TEC_GenItemCatGroup, TEC_GenItemCatGroup_L, TEC_Weight_Unit, TEC_Weight_Unit_L, TEC_Size_dimension, TEC_Size_dimension_L, TEC_Inspection_Setup, TEC_Inspection_Setup_L
                                   , TEC_Top_Sefi, TEC_Top_Sefi_L, TEC_Insp_Type, TEC_Insp_Type_L, TEC_Base_Unit_Of_Measure_L, TEC_Density, TEC_Density_L, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_X_L
                                   , TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_Bun_L
                                   , TEC_Net_Weight, TEC_Net_Weight_L, TEC_Volume, TEC_Volume_L, TEC_Unit_Of_Measure_L, TEC_Volume_Unit, TEC_Volume_Unit_L);
                    break;
                case "FORM-T003":
                    TEC_Title.Text = "Purchasing/Technical";
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                    TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                    TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                    TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                    TEC_Insp_Type_L.Text = "Inspection setup:";
                    SetVisible(true, TEC_A_Coat, TEC_A_Coat_L, TEC_Description_EN, TEC_Description_EN_L, TEC_Description_ZH, TEC_Description_ZH_L, TEC_Base_Unit_Of_Measure, TEC_Base_Unit_Of_Measure_L
                                   , TEC_Material_Group, TEC_Material_Group_L, TEC_Division, TEC_Division_L, TEC_Lab_Office_1, TEC_Lab_Office_1_L, TEC_Gross_Weight, TEC_Gross_Weight_L
                                   , TEC_GenItemCatGroup, TEC_GenItemCatGroup_L, TEC_Net_Weight, TEC_Net_Weight_L, TEC_Weight_Unit, TEC_Weight_Unit_L, TEC_Volume, TEC_Volume_L, TEC_Volume_Unit, TEC_Volume_Unit_L
                                   , TEC_Size_dimension, TEC_Size_dimension_L, TEC_Active, TEC_Active_L, TEC_Insp_Type, TEC_Insp_Type_L, TEC_Unit_Of_Measure_L
                                   , TEC_Density, TEC_Density_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L
                                   , TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Total_Shelf_life, TEC_Total_Shelf_life_L);
                    break;
                case "FORM-T007":
                    TEC_SEFI_Code_L.Text = "SEFI Code(Old Material Code)";
                    TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                    TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                    TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                    TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                    TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                    SetVisible(true, TEC_SEFI_Code, TEC_SEFI_Code_L, TEC_Description_EN, TEC_Description_EN_L, TEC_Description_ZH, TEC_Description_ZH_L, TEC_Base_Unit_Of_Measure, TEC_Base_Unit_Of_Measure_L
                                   , TEC_Material_Group, TEC_Material_Group_L, TEC_Division, TEC_Division_L, TEC_Lab_Office_1, TEC_Lab_Office_1_L, TEC_GenItemCatGroup, TEC_GenItemCatGroup_L
                                   , TEC_Gross_Weight, TEC_Gross_Weight_L, TEC_Net_Weight, TEC_Net_Weight_L, TEC_Weight_Unit, TEC_Weight_Unit_L, TEC_Volume, TEC_Volume_L
                                   , TEC_Volume_Unit, TEC_Volume_Unit_L, TEC_Size_dimension, TEC_Size_dimension_L, TEC_Inspection_Setup, TEC_Inspection_Setup_L, TEC_Insp_Type, TEC_Insp_Type_L
                                   , TEC_Top_Sefi, TEC_Top_Sefi_L, TEC_Unit_Of_Measure_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L
                                   , TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Density, TEC_Density_L);
                    break;

                case "FORM-TW-007":
                    TEC_SEFI_Code_L.Text = "Fini Code";
                    SetVisible(true, TEC_SEFI_Code, TEC_SEFI_Code_L,TEC_Recipe_Number, TEC_Recipe_Number_L, TEC_MSDS_EN, TEC_MSDS_EN_L, TEC_MSDS_CN, TEC_MSDS_CN_L);
                    break;

                
                    
                   

            }

            SetToolTip();
        }
        #endregion

        #region 方法 Distribute,Collect(分发, 收集值)
        public void Distribute(mdc_Material mt)
        {
            //如果当前 Tabs 是隐藏的情况，退出
            if (!IsUsed)
            {
                return;
            }

            if (((Parent as TabMaterial).Status.FORM == "FORM-012" || (Parent as TabMaterial).Status.FORM == "FORM-031") && (Parent as TabMaterial).Status.KeyWord == "MM2" && (Parent as TabMaterial).Status.Category == "FINI")
            {
                TEC_Density.Text = (Page as PMDC).TabMaterial1.Density;
                TEC_Color_Code.Text = (Page as PMDC).TabMaterial1.Color_Code;
            }
            //else if ((Parent as TabMaterial).Status.FORM == "FORM-012" && (Parent as TabMaterial).Status.KeyWord == "MM1" && (Parent as TabMaterial).Status.Category == "SEFI")
            //{
            //    //if ((Parent as TabCCC).gv_CCC_1.ChangedColumnIndex == 4)
            //    //{
            //        List<mdc_CCC> ccc_s = (Parent as TabCCC).gv_CCC_1.DataSource as List<mdc_CCC>;

            //        foreach (mdc_CCC ccc in ccc_s)
            //        {
            //            if (ccc.Package != null)
            //            {
            //                TEC_Pack_Size.Text = ccc.Package;
            //            }
            //        }
            //    //}
                
            //}
            
            else
            {
                TEC_Density.Text                    = mt.TEC_Density;
                TEC_Color_Code.Text                 = mt.TEC_Color_Code;
            }
            //if (!TaskAPI.IsInitiate)
            //{
            //    TEC_Plant.Items.Clear();
            //    TEC_Plant.Items.Add(new ListItem(mt.TEC_Plant, mt.TEC_Plant));
            //}
            TEC_Plant.SelectedValue                 = mt.TEC_Plant;
            TEC_A_Coat.Text                         = mt.TEC_A_Coat;
            TEC_Description_EN.Text                 = mt.TEC_Description_EN;
            TEC_Description_ZH.Text                 = mt.TEC_Description_ZH;
            TEC_Lab_Office.SelectedValue            = mt.TEC_Lab_Office;
            TEC_Division.Text                       = mt.TEC_Division;
            TEC_SEFI_Code.Text                      = mt.TEC_SEFI_Code;
            TEC_Recipe_Number.Text = mt.TEC_Recipe_Number;
            TEC_MSDS_EN.Text = mt.TEC_MSDS_EN;
            TEC_MSDS_CN.Text = mt.TEC_MSDS_CN;
            TEC_Remark.Text                         = mt.TEC_Remark;
            TEC_Relabel.SelectedValue               = mt.TEC_Relabel;
            TEC_MTO_Code_SEFI_Code.Text             = mt.TEC_MTO_Code_SEFI_Code;
            TEC_Top_Sefi.SelectedValue              = mt.TEC_Top_Sefi;
            TEC_Base_Unit_Of_Measure.SelectedValue  = mt.TEC_Base_Unit_Of_Measure;
            TEC_SAP_IP_Group.Text                   = mt.TEC_SAP_IP_Group;
            
            TEC_Inspection_Setup.SelectedValue      = mt.TEC_Inspection_Setup;
             
            TEC_Insp_Type.SelectedValue             = mt.TEC_Insp_Type;
            TEC_Material_Group.Text                 = mt.TEC_Material_Group;
            TEC_Unit_Of_Measure_X.Text              = mt.TEC_Unit_Of_Measure_X;
            TEC_Unit_Of_Measure_AUN.Text            = mt.TEC_Unit_Of_Measure_AUN;
            TEC_Unit_Of_Measure_Y.Text              = mt.TEC_Unit_Of_Measure_Y;
            TEC_Unit_Of_Measure_Bun.SelectedValue   = mt.TEC_Unit_Of_Measure_Bun;
            TEC_Gross_Weight.Text                   = mt.TEC_Gross_Weight;
            TEC_Weight_Unit.SelectedValue           = mt.TEC_Weight_Unit;
            TEC_GenItemCatGroup.Text                = mt.TEC_GenItemCatGroup;
            TEC_Subline.Text                        = mt.TEC_Subline;
            TEC_Pack_Size.Text                      = mt.TEC_Pack_Size;
            TEC_QM.SelectedValue                    = mt.TEC_QM;
            TEC_Active.SelectedValue                = mt.TEC_Active;
            TEC_Size_dimension.Text = mt.TEC_Size_dimension;
            TEC_Lab_Office_1.Text = mt.TEC_Lab_Office_1;
            TEC_Volume.Text = mt.TEC_Volume;
            TEC_Net_Weight.Text = mt.TEC_Net_Weight;
            TEC_Volume_Unit.Text = mt.TEC_Volume_Unit;

            TEC_Storage_Location.Text = mt.TEC_Storage_Location;
            TEC_Total_Shelf_life.Text = mt.TEC_Total_Shelf_life;
            //Tang Bin 添加
            TEC_Profit_Center.Text = mt.TEC_Profit_Center;

        }

        public void Collect(ref mdc_Material mt)
        {
            //如果当前 Tabs 是隐藏的情况，退出
            if (!IsUsed)
            {
                return;
            }

            mt.TEC_Plant                 = TEC_Plant.SelectedValue;
            mt.TEC_A_Coat                = TEC_A_Coat.Text;
            mt.TEC_Description_EN        = TEC_Description_EN.Text;
            mt.TEC_Description_ZH        = TEC_Description_ZH.Text;
            mt.TEC_Lab_Office            = TEC_Lab_Office.SelectedValue;
            mt.TEC_Density               = TEC_Density.Text;
            mt.TEC_Division              = TEC_Division.Text;
            mt.TEC_SEFI_Code             = TEC_SEFI_Code.Text;
            mt.TEC_Recipe_Number = TEC_Recipe_Number.Text;
            mt.TEC_MSDS_EN = TEC_MSDS_EN.Text;
            mt.TEC_MSDS_CN = TEC_MSDS_CN.Text;

            mt.TEC_Remark                = TEC_Remark.Text;
            mt.TEC_Relabel = TEC_Relabel.SelectedValue;
            mt.TEC_MTO_Code_SEFI_Code    = TEC_MTO_Code_SEFI_Code.Text;
            mt.TEC_Color_Code            = TEC_Color_Code.Text;
            mt.TEC_Top_Sefi              = TEC_Top_Sefi.SelectedValue;
            mt.TEC_Base_Unit_Of_Measure  = TEC_Base_Unit_Of_Measure.SelectedValue;
            mt.TEC_SAP_IP_Group          = TEC_SAP_IP_Group.Text;
            mt.TEC_Inspection_Setup      = TEC_Inspection_Setup.SelectedValue;
            mt.TEC_Insp_Type             = TEC_Insp_Type.SelectedValue;
            mt.TEC_Material_Group        = TEC_Material_Group.Text;
            mt.TEC_Unit_Of_Measure_X     = TEC_Unit_Of_Measure_X.Text;
            mt.TEC_Unit_Of_Measure_AUN   = TEC_Unit_Of_Measure_AUN.Text;
            mt.TEC_Unit_Of_Measure_Y     = TEC_Unit_Of_Measure_Y.Text;
            mt.TEC_Unit_Of_Measure_Bun   = TEC_Unit_Of_Measure_Bun.SelectedValue;
            mt.TEC_Gross_Weight          = TEC_Gross_Weight.Text;
            mt.TEC_Weight_Unit           = TEC_Weight_Unit.SelectedValue;
            mt.TEC_GenItemCatGroup       = TEC_GenItemCatGroup.Text;
            mt.TEC_Subline               = TEC_Subline.Text;
            mt.TEC_Pack_Size             = TEC_Pack_Size.Text;
            mt.TEC_QM                    = TEC_QM.SelectedValue;
            mt.TEC_Active                = TEC_Active.SelectedValue;
            mt.TEC_Size_dimension = TEC_Size_dimension.Text;
            mt.TEC_Lab_Office_1 = TEC_Lab_Office_1.Text;
            mt.TEC_Volume = TEC_Volume.Text;
            mt.TEC_Net_Weight = TEC_Net_Weight.Text;
            mt.TEC_Volume_Unit = TEC_Volume_Unit.Text;

            mt.TEC_Storage_Location = TEC_Storage_Location.Text;
            mt.TEC_Total_Shelf_life = TEC_Total_Shelf_life.Text;
            //Tang Bin 添加
            mt.TEC_Profit_Center=TEC_Profit_Center.Text;
        }
        #endregion

        #region 方法 SetDefaultValue(设置默认值, 并禁用输入)
        public void SetDefaultValue()
        {
            switch (Category)
            {
                case "RAW":
                    TEC_Base_Unit_Of_Measure.SelectedValue  = "KG";
                    TEC_Division.Text                       = "10";
                    TEC_GenItemCatGroup.Text                = "NORM";
                    TEC_Unit_Of_Measure_Bun.SelectedValue   = "KG";
                    TEC_Unit_Of_Measure_AUN.SelectedValue   = "L";
                    TEC_Unit_Of_Measure_X.Text              = "1000";
                    //if (FORM == "FORM-036" && TEC_QM.SelectedValue == "N")
                    //{
                    //    TEC_Active.SelectedIndex = -1;
                    //    SetEnable(false, TEC_Active);
                    //    SetForeColor(Color.Orange, TEC_Active_L);
                    //}
                    SetEnable(false, TEC_Base_Unit_Of_Measure, TEC_Division, TEC_GenItemCatGroup, TEC_Insp_Type, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_Y);
                    SetForeColor(Color.Orange, TEC_Base_Unit_Of_Measure_L, TEC_Division_L, TEC_GenItemCatGroup_L, TEC_Insp_Type_L, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_L);
                    if (FORM == "FORM-036")
                    {
                        TEC_Plant.SelectedValue             = "K15P";
                        TEC_Insp_Type.SelectedValue         = "01";
                    }
                    //if (FORM == "FORM-T003")
                    //{
                    //    TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                    //    TEC_Division.Text = "10";
                    //    TEC_Gross_Weight.Text = "1";
                    //    TEC_GenItemCatGroup.Text = "NORM";
                    //    TEC_Net_Weight.Text = "1";
                    //    TEC_Weight_Unit.SelectedValue = "KG";
                    //    TEC_Volume_Unit.Text = "L";
                    //    TEC_Size_dimension.Text = "KG";
                    //    TEC_Insp_Type.SelectedValue = "01";
                    //    TEC_Unit_Of_Measure_X.Text = "1000";
                    //    TEC_Unit_Of_Measure_AUN.SelectedValue = "L";
                    //    TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                    //    SetEnable(false, TEC_Base_Unit_Of_Measure, TEC_Division, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Net_Weight, TEC_Weight_Unit, TEC_Volume_Unit
                    //                   , TEC_Size_dimension, TEC_Insp_Type, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun);
                    //    SetForeColor(Color.Orange, TEC_Base_Unit_Of_Measure_L, TEC_Division_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L, TEC_Net_Weight_L, TEC_Weight_Unit_L, TEC_Volume_Unit_L
                    //                             , TEC_Size_dimension_L, TEC_Insp_Type_L);
                    //}
                    break;
                case "PACK":
                    TEC_Insp_Type.SelectedValue = "01";
                    SetEnable(false, TEC_Insp_Type);
                    SetForeColor(Color.Orange, TEC_Insp_Type_L);
                    break;
                case "SEFI":
                    if (FORM == "FORM-035")
                    {
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_Insp_Type.Text = "04";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Gross_Weight.Text = "1";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        TEC_Unit_Of_Measure_AUN.SelectedValue = "L";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Division.Text = "10";
                        TEC_Top_Sefi.SelectedValue = "Y";
                        SetEnable(false, TEC_Top_Sefi,TEC_Insp_Type, TEC_Base_Unit_Of_Measure, TEC_Gross_Weight, TEC_Weight_Unit, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_Y, TEC_Division);
                        SetForeColor(Color.Orange, TEC_Top_Sefi_L,TEC_Insp_Type_L, TEC_Base_Unit_Of_Measure_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_L, TEC_Division_L);
                    }
                    
                    if (FORM == "FORM-TW-004")
                    {
                        TEC_Base_Unit_Of_Measure.Text = "KG";
                        TEC_Division.Text = "10";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Size_dimension.Text = "PC";
                    }
                    if (FORM == "FORM-T008")
                    {
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        TEC_Material_Group.Text = "H";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office_1.Text = "K23";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Gross_Weight.Text = "1";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Net_Weight.Text = "1";
                        TEC_Volume_Unit.Text = "L";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Volume_Unit.Text = "L";
                        SetEnable(false, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Base_Unit_Of_Measure
                                       , TEC_Material_Group, TEC_Division, TEC_Lab_Office_1, TEC_Weight_Unit, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Net_Weight
                                       , TEC_Volume_Unit, TEC_Size_dimension, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Volume_Unit);
                        SetForeColor(Color.Orange, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Base_Unit_Of_Measure_L
                                                 , TEC_Material_Group_L, TEC_Division_L, TEC_Lab_Office_1_L, TEC_Weight_Unit_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L
                                                 , TEC_Volume_Unit_L, TEC_Size_dimension_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Volume_Unit_L,TEC_Net_Weight_L);
                    }
                    if (FORM == "FORM-T007")
                    {
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        TEC_Material_Group.Text = "H";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office_1.Text = "K23";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Gross_Weight.Text = "1";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Net_Weight.Text = "1";
                        TEC_Volume_Unit.Text = "L";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Volume_Unit.Text = "L";
                        SetEnable(false, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Base_Unit_Of_Measure
                                       , TEC_Material_Group, TEC_Division, TEC_Lab_Office_1, TEC_Weight_Unit, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Net_Weight
                                       , TEC_Volume_Unit, TEC_Size_dimension, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Volume_Unit);
                        SetForeColor(Color.Orange, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Base_Unit_Of_Measure_L
                                                 , TEC_Material_Group_L, TEC_Division_L, TEC_Lab_Office_1_L, TEC_Weight_Unit_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L
                                                 , TEC_Volume_Unit_L, TEC_Size_dimension_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Volume_Unit_L, TEC_Net_Weight_L);
                    }
                    if (FORM == "FORM-T011-1")
                    {
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        TEC_Material_Group.Text = "H";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office_1.Text = "K51";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Gross_Weight.Text = "1";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Net_Weight.Text = "1";
                        TEC_Volume_Unit.Text = "L";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Volume_Unit.Text = "L";
                        SetEnable(false, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Base_Unit_Of_Measure
                                       , TEC_Material_Group, TEC_Division, TEC_Lab_Office_1, TEC_Weight_Unit, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Net_Weight
                                       , TEC_Volume_Unit, TEC_Size_dimension, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Volume_Unit);
                        SetForeColor(Color.Orange, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Base_Unit_Of_Measure_L
                                                 , TEC_Material_Group_L, TEC_Division_L, TEC_Lab_Office_1_L, TEC_Weight_Unit_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L
                                                 , TEC_Volume_Unit_L, TEC_Size_dimension_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Volume_Unit_L, TEC_Net_Weight_L);
                    }
                    if (FORM == "FORM-T011")
                    {
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        TEC_Material_Group.Text = "H";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office_1.Text = "K51";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Gross_Weight.Text = "1";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Net_Weight.Text = "1";
                        TEC_Volume_Unit.Text = "L";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Volume_Unit.Text = "L";
                        if (TEC_Top_Sefi.SelectedValue == "Y")
                        {
                            (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "ESP";
                        }
                        else if (TEC_Top_Sefi.SelectedValue == "N")
                        {
                            (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "ESL";
                        }
                        else
                        {
                            (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "";
                        }
                        SetEnable(false, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun, TEC_Base_Unit_Of_Measure
                                       , TEC_Material_Group, TEC_Division, TEC_Lab_Office_1, TEC_Weight_Unit, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Net_Weight
                                       , TEC_Volume_Unit, TEC_Size_dimension, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Volume_Unit);
                        SetForeColor(Color.Orange, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_Bun_L, TEC_Base_Unit_Of_Measure_L
                                                 , TEC_Material_Group_L, TEC_Division_L, TEC_Lab_Office_1_L, TEC_Weight_Unit_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L
                                                 , TEC_Volume_Unit_L, TEC_Size_dimension_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Volume_Unit_L, TEC_Net_Weight_L);
                    }
                    else
                    {
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_Insp_Type.Text = "04";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Gross_Weight.Text = "1";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        TEC_Unit_Of_Measure_AUN.SelectedValue = "L";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Division.Text = "10";
                        if (TaskAPI.Process == "MTO Base Code Application" && TaskAPI.Step == "Technical")
                        {
                            IList<mdc_CCC> ccc_s = (mdc_CCC.process == TaskAPI.Process & mdc_CCC.incident == TaskAPI.Incident & mdc_CCC.status == 1).List<mdc_CCC>();
                            foreach (mdc_CCC ccc in ccc_s)
                            {
                                this.TEC_Pack_Size.Text = ccc.Package;

                            }
                        }
                        SetEnable(false, TEC_Insp_Type, TEC_Base_Unit_Of_Measure, TEC_Gross_Weight, TEC_Weight_Unit, TEC_Unit_Of_Measure_Bun, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_Y, TEC_Division);
                        SetForeColor(Color.Orange, TEC_Insp_Type_L, TEC_Base_Unit_Of_Measure_L, TEC_Gross_Weight_L, TEC_Weight_Unit_L, TEC_Unit_Of_Measure_Bun_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_X_L, TEC_Unit_Of_Measure_Y_L, TEC_Unit_Of_Measure_L, TEC_Division_L);
                    }
                    
                    break;
                case "FINI":
                    if (FORM == "FORM-TW-003" || FORM == "FORM-TW-011" || FORM == "FORM-TW-004" || FORM == "FORM-TW-007-1")
                    {
                        TEC_Gross_Weight.Text = "1";
                        TEC_Net_Weight.Text = "1";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Volume_Unit.Text = "L";
                        SetEnable(false, TEC_Gross_Weight, TEC_Net_Weight, TEC_Weight_Unit, TEC_Volume_Unit);
                        SetForeColor(Color.Orange,  TEC_Gross_Weight_L, TEC_Net_Weight_L, TEC_Weight_Unit_L, TEC_Volume_Unit_L);
                    }
                    if (FORM == "FORM-TW-003")
                    {
                        TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                        TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                        TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                        TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                        TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                        TEC_Base_Unit_Of_Measure.Text = "KG";
                        TEC_Division.Text = "10";
                        TEC_Insp_Type.SelectedValue = "01";
                        TEC_Gross_Weight.Text = "1";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_AUN.Text = "L";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";

                        SetEnable(false, TEC_Lab_Office_1_L,TEC_Insp_Type, TEC_Division, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Size_dimension, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Base_Unit_Of_Measure, TEC_Unit_Of_Measure_Bun);
                        SetForeColor(Color.Orange, TEC_Lab_Office_1_L,TEC_Unit_Of_Measure_X_L,TEC_Insp_Type_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Bun_L, TEC_Base_Unit_Of_Measure_L, TEC_Division_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L, TEC_Size_dimension_L);
                    }
                    if (FORM == "FORM-TW-011")
                    {
                        TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                        TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                        TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                        TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                        TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                        TEC_Base_Unit_Of_Measure.Text = "KG";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office_1.Text = "K51"; 
                        TEC_Material_Group.Text = "H";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_AUN.Text = "L";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        SetEnable(false,TEC_Unit_Of_Measure_Bun, TEC_Material_Group,TEC_Lab_Office_1, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Division, TEC_Base_Unit_Of_Measure, TEC_GenItemCatGroup, TEC_Size_dimension, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Base_Unit_Of_Measure);
                        SetForeColor(Color.Orange, TEC_Lab_Office_1_L,TEC_Material_Group_L, TEC_Unit_Of_Measure_X_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L,  TEC_Division_L, TEC_Base_Unit_Of_Measure_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Bun_L, TEC_GenItemCatGroup_L, TEC_Size_dimension_L);
                        SetForeColor(Color.Blue, TEC_Unit_Of_Measure_L); 
                    }
                    if (FORM == "FORM-TW-010")
                    {
                        TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                        TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                        TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                        TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                        TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                        TEC_Base_Unit_Of_Measure.Text = "KG";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office.SelectedValue = "K51";
                        TEC_Material_Group.Text = "H";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_AUN.Text = "L";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        SetEnable(false, TEC_Material_Group, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Lab_Office, TEC_Division, TEC_Base_Unit_Of_Measure, TEC_GenItemCatGroup, TEC_Size_dimension, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Base_Unit_Of_Measure);
                        SetForeColor(Color.Orange, TEC_Material_Group_L, TEC_Unit_Of_Measure_X_L,TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Lab_Office_L, TEC_Division_L, TEC_Base_Unit_Of_Measure_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Bun_L, TEC_GenItemCatGroup_L, TEC_Size_dimension_L);
                    }
                    if (FORM == "FORM-TW-004")
                    {
                        
                        TEC_Base_Unit_Of_Measure.SelectedValue = "PC";
                        TEC_Insp_Type.SelectedValue = "01";
                        TEC_Division.Text = "10";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Size_dimension.Text = "PC";
                        if (TaskAPI.Process == "TW NPL Application-PKG")
                        {
                            TEC_Lab_Office_1.Text = "K53";
                        }
                        if (TaskAPI.Process == "TW NPL Application-DECO")
                        {

                            TEC_Lab_Office_1.Text = "K26";
                        }
                        SetEnable(false, TEC_Lab_Office_1, TEC_Base_Unit_Of_Measure, TEC_Insp_Type, TEC_Division, TEC_GenItemCatGroup, TEC_Size_dimension);
                        SetForeColor(Color.Orange,TEC_Lab_Office_1_L, TEC_Insp_Type_L, TEC_Division_L, TEC_Base_Unit_Of_Measure_L, TEC_GenItemCatGroup_L, TEC_Size_dimension_L);

                    }
                    if (FORM == "FORM-TW-007-1")
                    {
                        TEC_Description_ZH_L.Text = "Description 2 (ZF.):";
                        TEC_Unit_Of_Measure_X_L.Text = "Denominator";
                        TEC_Unit_Of_Measure_AUN_L.Text = "Alternative Unit of measure";
                        TEC_Unit_Of_Measure_Y_L.Text = "Numerator";
                        TEC_Unit_Of_Measure_Bun_L.Text = "Base Unit of Measure";
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Division.Text = "10";
                        TEC_Lab_Office_1.Text = "K23";
                        TEC_Material_Group.Text = "H";
                        TEC_Insp_Type.SelectedValue = "04";
                        TEC_Inspection_Setup.SelectedValue = "Y";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_AUN.Text = "L";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";

                        SetEnable(false, TEC_Material_Group, TEC_Unit_Of_Measure_Bun,TEC_Lab_Office_1, TEC_Inspection_Setup, TEC_Insp_Type, TEC_Lab_Office, TEC_Division, TEC_Base_Unit_Of_Measure, TEC_GenItemCatGroup, TEC_Size_dimension, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Base_Unit_Of_Measure);
                        SetForeColor(Color.Orange, TEC_Lab_Office_1_L,TEC_Material_Group_L, TEC_Unit_Of_Measure_X_L, TEC_Inspection_Setup_L, TEC_Insp_Type_L, TEC_Lab_Office_L, TEC_Division_L, TEC_Base_Unit_Of_Measure_L, TEC_Unit_Of_Measure_AUN_L, TEC_Unit_Of_Measure_Bun_L, TEC_GenItemCatGroup_L, TEC_Size_dimension_L);

                    }
                    if (FORM == "FORM-T003")
                    {
                        TEC_Base_Unit_Of_Measure.SelectedValue = "KG";
                        TEC_Division.Text = "10";
                        TEC_Gross_Weight.Text = "1";
                        TEC_GenItemCatGroup.Text = "NORM";
                        TEC_Net_Weight.Text = "1";
                        TEC_Weight_Unit.SelectedValue = "KG";
                        TEC_Volume_Unit.Text = "L";
                        TEC_Size_dimension.Text = "KG";
                        TEC_Insp_Type.SelectedValue = "01";
                        TEC_Unit_Of_Measure_X.Text = "1000";
                        TEC_Unit_Of_Measure_AUN.SelectedValue = "L";
                        TEC_Unit_Of_Measure_Bun.SelectedValue = "KG";
                        SetEnable(false, TEC_Base_Unit_Of_Measure, TEC_Division, TEC_Gross_Weight, TEC_GenItemCatGroup, TEC_Net_Weight, TEC_Weight_Unit, TEC_Volume_Unit, TEC_Lab_Office_1
                                       , TEC_Size_dimension, TEC_Insp_Type, TEC_Unit_Of_Measure_X, TEC_Unit_Of_Measure_AUN, TEC_Unit_Of_Measure_Y, TEC_Unit_Of_Measure_Bun);
                        SetForeColor(Color.Orange, TEC_Base_Unit_Of_Measure_L, TEC_Division_L, TEC_Gross_Weight_L, TEC_GenItemCatGroup_L, TEC_Net_Weight_L, TEC_Weight_Unit_L, TEC_Volume_Unit_L
                                                 , TEC_Size_dimension_L, TEC_Insp_Type_L, TEC_Lab_Office_1_L);
                    }
                    break;
            }
        }
        #endregion

        #region 方法 SetToolTip (设置控件 ToolTip)
        public void SetToolTip()
        {
            switch(Category)
            {
                case "RAW":
                    TEC_Base_Unit_Of_Measure.ToolTip    = "基本单位(默认KG)";
                    TEC_Density.ToolTip                 = "密度(不超过3位小数)";
                    TEC_Description_EN.ToolTip          = "英文描述(不超过40个字节)";
                    TEC_Description_ZH.ToolTip          = "中文描述(不超过40个字节)";
                    TEC_Division.ToolTip                = "产品组(默认为10: General(incl. Exp.))";
                    TEC_GenItemCatGroup.ToolTip         = "普通项目类别组(默认为NORM: Standard item)";
                    TEC_Insp_Type.ToolTip               = "是否需要检验计划";
                    TEC_Lab_Office.ToolTip              = "产品层次(Category + Segment)(请参照CRM0006)";
                    TEC_Material_Group.ToolTip          = "物料组(A+Acoat前2位)";
                    TEC_Plant.ToolTip                   = "需要扩展的工厂(仅存在P-Plant)";
                    TEC_Unit_Of_Measure_Y.ToolTip       = "单位换算(1000 L=Density*1000 KG)";
                    TEC_Plant.ToolTip                   = "仅存在P-plant";
                    TEC_QM.ToolTip                      = "QM试图";
                    TEC_Active.ToolTip                  = "是否需要检验计划，若免检为N";
                    if (FORM == "FORM-T003")
                    {
                        TEC_GenItemCatGroup.ToolTip = "普通項目類別組";
                        TEC_Description_EN.ToolTip = "ACOAT+PACK SIZE+Descrip,all need Caps";
                        TEC_Description_ZH.ToolTip = "ACOAT+PACK SIZE+Descrip,all need Caps(Descrip EN=Descrip ZH)";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位（默認為KG）";
                        TEC_Inspection_Setup.ToolTip = "是否需要检验计划";
                        TEC_Lab_Office_1.ToolTip = "實驗室/設計室";
                        TEC_Material_Group.ToolTip = "物料組(A+Acoat前2位)";
                        TEC_Division.ToolTip = "產品組默認為10";
                        TEC_Size_dimension.ToolTip = "大小/量綱(默認為KG)";
                        TEC_Active.ToolTip = "是否需要檢查";
                        TEC_Insp_Type.ToolTip = "检验类型(默认为01)";
                        TEC_Unit_Of_Measure_Y.ToolTip = "密度乘以1000";
                        TEC_Unit_Of_Measure_X.ToolTip = "";
                    }
                    break;
                case "SEFI":
                    TEC_Insp_Type.ToolTip               = "检验类型(默认为04: Goods receipt inspection from production)";
                    TEC_Lab_Office.ToolTip              = "产品层次(Category + Segment)(请参照CRM0006)";
                    TEC_SEFI_Code.ToolTip               = "BPCS code 产品线＋色号 EG, A728-H68002";
                    TEC_Description_EN.ToolTip          = "英文描述（不超过40个字节）\n（If “Top Sefi”: Brand+Descrip(EN)+Product line+Sefi code; \n If not,Sefi code+Descrip(EN)）";
                    TEC_Description_ZH.ToolTip          = "中文描述（不超过40个字节）（SEFI Code+Description 2 (Chinese)）";
                    TEC_Density.ToolTip                 = "密度，最多三位小数";
                    TEC_Remark.ToolTip                  = "当此半成品对应的成品存在于系统，并且只有一个成品，需要告知其对应的FINI SAP Code，其他情况，我们会将 Profit Center设为89；";
                    //TEC_Top_Sefi.ToolTip                = "是否为Top Sefi";
                    TEC_Base_Unit_Of_Measure.ToolTip    = "基本单位（默认KG）";
                    TEC_Inspection_Setup.ToolTip        = "检验类型（默认为04: Goods receipt inspection from production）";
                    TEC_Top_Sefi.ToolTip                = "是否是 Top Sefi(Y/N)";
                    TEC_Inspection_Setup.ToolTip        = "检验计划(需要设检验计划，则填“Y”，不需要设检验计划，则填“N”)";
                    TEC_Inspection_Setup.ToolTip        = "检验计划(需要设检验计划，则填“Y”，不需要设检验计划，则填“N”)";
                    TEC_Weight_Unit.ToolTip             = "重量单位(默认为KG)";
                    TEC_MTO_Code_SEFI_Code.ToolTip      = "产品线+色号外部号码，编码规则同原BPCS号";
                    TEC_Subline.ToolTip                 = "子产品线";
                    TEC_Division.ToolTip                = "产品组默认为10";
                    TEC_SAP_IP_Group.ToolTip            = "QC的模板";
                    TEC_Pack_Size.ToolTip               = "包装尺寸";
                    if (FORM.IndexOf("T") !=-1)
                    {
                        TEC_SEFI_Code.ToolTip = "物料編號";
                        TEC_Description_EN.ToolTip = "物料英文描述 不超過40個字節，PC+産品名稱＋産品描述＋SKU＋産品名稱";
                        TEC_Description_ZH.ToolTip = "物料中文描述 不超過40個字節，産評名稱＋産品描述＋SKU";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位";
                        TEC_Insp_Type.ToolTip = "檢驗類型";
                        TEC_Lab_Office_1.ToolTip = "實驗室/設計室";
                        TEC_Lab_Office.ToolTip = "實驗室/設計室";
                        TEC_Material_Group.ToolTip = "物料組 默認為H";
                        TEC_Division.ToolTip = "產品組";
                        TEC_Inspection_Setup.ToolTip = "是否需要檢驗，Sefi 默認都需要";
                        TEC_Size_dimension.ToolTip = "大小/量綱";
                        TEC_Active.ToolTip = "是否需要檢查";
                        TEC_Insp_Type.ToolTip = "检验类型";
                        TEC_Unit_Of_Measure_Y.ToolTip = "密度乘以1000";
                        //TEC_Top_Sefi.ToolTip = "請選擇";
                        TEC_Volume_Unit.ToolTip = "體積單位 默認爲L";
                        TEC_Volume.ToolTip = "體積 不超過三位小數";
                        TEC_Top_Sefi.ToolTip = "請選擇,是否爲Top Sefi";
                        TEC_Net_Weight.ToolTip = "淨重 ，不超過三位小數";
                        TEC_Material_Group.ToolTip = "物料組,默認爲H";
                        TEC_Size_dimension.ToolTip = "大小/量綱,默認爲KG";
                        TEC_Gross_Weight.ToolTip = "毛重，不超過三位小數 ";
                        TEC_Volume.ToolTip = "體積,不超過三位小數";
                        TEC_Unit_Of_Measure_X.ToolTip = "轉換爲基本計量單位的分母，MM080, Alternative Unit of measure爲L";
                        TEC_Unit_Of_Measure_Y.ToolTip = "基本計量單位轉換分子，Density*1000, MM080, Baisc Unit of Measure爲PC";
                        if (FORM == "FORM-TW-007" || FORM == "FORM-TW-007-1")
                        {
                            TEC_Description_EN.ToolTip = "不超過40個字節，Sefi Code＋英文描述;即MM070: Material short text ENGLISH）";
                            TEC_Description_ZH.ToolTip = "不超過40個字節，Sefi Code＋中文描述;即MM070: Additional language short text";
                        }
                    }
                    if (FORM == "FORM-T008")
                    {
                        TEC_SEFI_Code.ToolTip = "物料編號";
                        TEC_Description_EN.ToolTip = "物料英文描述:不超過40個字節，Sefi Code＋英文描述,即MM070: Material short text ENGLISH";
                        TEC_Description_ZH.ToolTip = "物料中文描述:不超過40個字節，Sefi Code＋中文描述,即MM070: Additional language short text";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位 默認為KG";
                        TEC_Material_Group.ToolTip = "物料組 默認為H";
                        TEC_Division.ToolTip = "産品組 默認為10";
                        TEC_Lab_Office.ToolTip = "實驗室/設計室 即MM070: Lab./Office,默認為K23";
                        TEC_Gross_Weight.ToolTip = "毛重 默認為1";
                        TEC_Net_Weight.ToolTip = "淨重 默認為1";
                        TEC_Weight_Unit.ToolTip = "重量單位 默認爲KG";
                        TEC_Volume.ToolTip = "體積 不超過三位小數";
                        TEC_Volume_Unit.ToolTip = "體積單位 默認爲L";
                        TEC_Size_dimension.ToolTip = "大小/量綱 默認為KG";
                        TEC_Inspection_Setup.ToolTip = "是否需要檢驗計劃 SEFI默認都需要";
                        TEC_Top_Sefi.ToolTip = "請選擇 該SEFI是Top Sefi還是Low Sefi？";
                        TEC_Insp_Type.ToolTip = "檢驗類型 默認為04";

                    }
                    if (FORM == "FORM-T011")
                    {
                        TEC_SEFI_Code.ToolTip = "物料編號";
                        TEC_Description_EN.ToolTip = "英文描述 PC+産品名稱＋産品描述＋SKU＋産品名稱不超過40個字節";
                        TEC_Description_ZH.ToolTip = "中文描述 産評名稱＋産品描述＋SKU不超過40個字節";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位 默認為KG";
                        TEC_Material_Group.ToolTip = "物料組 默認為H";
                        TEC_Division.ToolTip = "産品組 默認為10";
                        TEC_Lab_Office.ToolTip = "實驗室/設計室,默認為K51";
                        TEC_Gross_Weight.ToolTip = "毛重 默認為1";
                        TEC_Net_Weight.ToolTip = "淨重 默認為1";
                        TEC_Weight_Unit.ToolTip = "重量單位 默認爲KG";
                        TEC_Volume.ToolTip = "體積 不超過三位小數";
                        TEC_Volume_Unit.ToolTip = "體積單位 默認爲L";
                        TEC_Size_dimension.ToolTip = "大小/量綱 默認為KG";
                        TEC_Inspection_Setup.ToolTip = "是否需要檢驗計劃 SEFI默認都需要";
                        TEC_Top_Sefi.ToolTip = "請選擇 該SEFI是Top Sefi還是Low Sefi？";
                        TEC_Insp_Type.ToolTip = "檢驗類型 默認為04";

                    }
                    if (FORM == "FORM-T007")
                    {
                        TEC_SEFI_Code.ToolTip = "物料編號";
                        TEC_Description_EN.ToolTip = "物料英文描述 不超過40個字節，Sefi Code＋英文描述 即MM070: Material short text ENGLISH";
                        TEC_Description_ZH.ToolTip = "物料中文描述 不超過40個字節，Sefi Code＋中文描述 即MM070: Additional language short text";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位";
                        TEC_Material_Group.ToolTip = "物料組";
                        TEC_Division.ToolTip = "産品組";
                        TEC_Lab_Office_1.ToolTip = "實驗室/設計室";
                        TEC_GenItemCatGroup.ToolTip = "普通項目類別組";
                        TEC_Gross_Weight.ToolTip = "毛重";
                        TEC_Net_Weight.ToolTip = "淨重";
                        TEC_Weight_Unit.ToolTip = "重量單位";
                        TEC_Volume.ToolTip = "體積";
                        TEC_Volume_Unit.ToolTip = "體積單位";
                        TEC_Size_dimension.ToolTip = "大小/量綱";
                        TEC_Inspection_Setup.ToolTip = "是否需要檢驗計劃 SEFI默認都需要";
                        TEC_Insp_Type.ToolTip = "檢驗類型";
                        TEC_Top_Sefi.ToolTip = "請選擇 該Sefi是Top Sefi還是Low Sefi？";
                        TEC_Unit_Of_Measure_X.ToolTip = "轉換爲基本計量單位的分子 Density*1000, MM080, Baisc Unit of Measure爲PC";
                        TEC_Unit_Of_Measure_Y.ToolTip = "轉換爲基本計量單位的分子 Density*1000, MM080, Baisc Unit of Measure爲PC";
                        TEC_Unit_Of_Measure_Bun.ToolTip = "基本計量單位";
                    }
                    if (FORM == "FORM-T011-1")
                    {
                        TEC_SEFI_Code.ToolTip = "物料編號";
                        TEC_Description_EN.ToolTip = "物料英文描述Brand Code+産品名稱＋産品描述，不超過40個字節";
                        TEC_Description_ZH.ToolTip = "物料中文描述Brand Code+産品名稱＋産品描述，不超過40個字節";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位";
                        TEC_Material_Group.ToolTip = "物料組";
                        TEC_Division.ToolTip = "産品組";
                        TEC_Lab_Office_1.ToolTip = "實驗室/設計室";
                        TEC_GenItemCatGroup.ToolTip = "普通項目類別組";
                        TEC_Gross_Weight.ToolTip = "毛重";
                        TEC_Net_Weight.ToolTip = "淨重";
                        TEC_Weight_Unit.ToolTip = "重量單位";
                        TEC_Volume.ToolTip = "體積";
                        TEC_Volume_Unit.ToolTip = "體積單位";
                        TEC_Size_dimension.ToolTip = "大小/量綱";
                        TEC_Inspection_Setup.ToolTip = "是否需要檢驗計劃 SEFI默認都需要";
                        TEC_Insp_Type.ToolTip = "檢驗類型";
                        TEC_Top_Sefi.ToolTip = "請選擇 該Sefi是Top Sefi還是Low Sefi？";
                        TEC_Unit_Of_Measure_X.ToolTip = "轉換爲基本計量單位的分子 Density*1000, MM080, Baisc Unit of Measure爲PC";
                        TEC_Unit_Of_Measure_Y.ToolTip = "轉換爲基本計量單位的分子 Density*1000, MM080, Baisc Unit of Measure爲PC";
                        TEC_Unit_Of_Measure_Bun.ToolTip = "基本計量單位";
                    }
                    break;
                case "FINI":
                case "TRADE":
                    TEC_Color_Code.ToolTip              = "色号";
                    TEC_Lab_Office.ToolTip              = "产品层次(Category + Segment)(请参照CRM0006)";
                    TEC_Density.ToolTip                 = "密度，最多三位小数";

                    if (FORM.IndexOf("T") != -1)
                    {

                        TEC_SEFI_Code.ToolTip = "物料編號";
 
                        TEC_Description_EN.ToolTip = "物料英文描述:不超過40個字節";
                        TEC_Description_ZH.ToolTip = "物料中文描述:不超過40個字節";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位";
                        TEC_Insp_Type.ToolTip = "檢驗類型";
                        TEC_Lab_Office_1.ToolTip = "實驗室/設計室";
                        TEC_Lab_Office.ToolTip = "實驗室/設計室";
                        TEC_Material_Group.ToolTip = "物料組";
                        TEC_Division.ToolTip = "產品組";
                        TEC_Inspection_Setup.ToolTip = "是否需要檢驗計畫";
                        TEC_Size_dimension.ToolTip = "大小/量綱";
                        TEC_Active.ToolTip = "是否需要檢驗";
                        TEC_Insp_Type.ToolTip = "檢驗類型";
                        TEC_Unit_Of_Measure_Y.ToolTip = "密度乘以1000";
                        TEC_Lab_Office.ToolTip = "實驗室/設計室";
                        TEC_Gross_Weight.ToolTip = "毛重 不超過三位小數";
                        TEC_Net_Weight.ToolTip = "淨重 不超過三位小數";
                        TEC_Weight_Unit.ToolTip = "重量單位";
                        TEC_Volume.ToolTip = "體積 不超過三位小數";
                        TEC_Volume_Unit.ToolTip = "體積單位";
                        TEC_GenItemCatGroup.ToolTip = "普通項目類別組";
                        TEC_Top_Sefi.ToolTip = "請選擇，該SEFI是Top Sefi還是Low Sefi？";
                        TEC_Unit_Of_Measure_X.ToolTip = "轉換爲基本計量單位的分母";
                        TEC_Unit_Of_Measure_Y.ToolTip = "基本計量單位轉換分子";
                        if (FORM == "FORM-TW-011" || FORM == "FORM-TW-007-1")
                        {
                            TEC_Unit_Of_Measure_X.ToolTip = "轉換爲基本計量單位的分母，MM080, Alternative Unit of measure爲L";
                            TEC_Unit_Of_Measure_Y.ToolTip = "基本計量單位轉換分子，Density*1000, MM080, Baisc Unit of Measure爲PC";
                            TEC_Description_EN.ToolTip = "不超過40個字節，Sefi Code＋英文描述;即MM070: Material short text ENGLISH）";
                            TEC_Description_ZH.ToolTip = "不超過40個字節，Sefi Code＋中文描述;即MM070: Additional language short text";
                            if (FORM == "FORM-TW-011" || FORM == "FORM-T007")
                            {
                                TEC_Description_EN.ToolTip = "物料英文描述Brand Code+産品名稱＋産品描述，不超過40個字節";
                                TEC_Description_ZH.ToolTip = "物料中文描述Brand Code+産品名稱＋産品描述，不超過40個字節";
                                TEC_Lab_Office_1.ToolTip = "實驗室/設計室 即MM070: Lab./Office";
                            }
                            TEC_Inspection_Setup.ToolTip = "是否需要檢驗，Sefi 默認都需要";
                        }
                        if (FORM == "FORM-TW-010")
                        {
                            
                            TEC_Description_EN.ToolTip = "物料英文描述Brand Code+産品名稱＋産品描述＋Pack size，不超過40個字節";
                            TEC_Description_ZH.ToolTip = "物料中文描述Brand Code+産品名稱＋産品描述＋Pack size，不超過40個字節";
                        }
                    }
                    if (FORM == "FORM-TW-003" || FORM == "FORM-T003")
                    {
                        TEC_GenItemCatGroup.ToolTip = "普通項目類別組";
                        TEC_Description_EN.ToolTip = "ACOAT+PACK SIZE+ 英文描述（不超過40個字節）";
                        TEC_Description_ZH.ToolTip = "ACOAT+PACK SIZE+ 中文描述（不超過40個字節）";
                        TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位（默認為KG）";
                        TEC_Inspection_Setup.ToolTip = "是否需要检验计划";
                        TEC_Lab_Office_1.ToolTip = "實驗室/設計室(PKG: K52, DECO: K25)";
                        TEC_Material_Group.ToolTip = "物料組(A+Acoat前2位)";
                        TEC_Division.ToolTip = "產品組默認為10";
                        TEC_Size_dimension.ToolTip = "大小/量綱(默認為KG)";
                        TEC_Active.ToolTip = "是否需要檢查";
                        TEC_Insp_Type.ToolTip = "检验类型(默认为01)";
                        TEC_Unit_Of_Measure_Y.ToolTip = "密度乘以1000";
                        TEC_Unit_Of_Measure_X.ToolTip = "";
                        TEC_Total_Shelf_life.ToolTip = "總貨架壽命";
                    }
                    //if (FORM == "FORM-T007")
                    //{
                    //    TEC_SEFI_Code.ToolTip = "物料編號";
                    //    TEC_Description_EN.ToolTip = "物料英文描述 不超過40個字節，Sefi Code＋英文描述 即MM070: Material short text ENGLISH";
                    //    TEC_Description_ZH.ToolTip = "物料中文描述 不超過40個字節，Sefi Code＋中文描述 即MM070: Additional language short text";
                    //    TEC_Base_Unit_Of_Measure.ToolTip = "基本計量單位";
                    //    TEC_Material_Group.ToolTip = "物料組";
                    //    TEC_Division.ToolTip = "産品組";
                    //    TEC_Lab_Office_1.ToolTip = "實驗室/設計室";
                    //    TEC_GenItemCatGroup.ToolTip = "普通項目類別組";
                    //    TEC_Gross_Weight.ToolTip = "毛重";
                    //    TEC_Net_Weight.ToolTip = "淨重";
                    //    TEC_Weight_Unit.ToolTip = "重量單位";
                    //    TEC_Volume.ToolTip = "體積";
                    //    TEC_Volume_Unit.ToolTip = "體積單位";
                    //    TEC_Size_dimension.ToolTip = "大小/量綱";
                    //    TEC_Inspection_Setup.ToolTip = "是否需要檢驗計劃 SEFI默認都需要";
                    //    TEC_Insp_Type.ToolTip = "檢驗類型";
                    //    TEC_Top_Sefi.ToolTip = "請選擇 該Sefi是Top Sefi還是Low Sefi？";
                    //    TEC_Unit_Of_Measure_X.ToolTip = "轉換爲基本計量單位的分子 Density*1000, MM080, Baisc Unit of Measure爲PC";
                    //    TEC_Unit_Of_Measure_Y.ToolTip = "轉換爲基本計量單位的分子 Density*1000, MM080, Baisc Unit of Measure爲PC";
                    //    TEC_Unit_Of_Measure_Bun.ToolTip = "基本計量單位";
                    //}
                    break;
            }
        }
        #endregion

        #region 方法 DataValidation(数据验证)
        public List<string> DataValidation(mdc_Material mt, string Sheet)
        {
            //如果当前 Tabs 是隐藏的情况，退出
            List<string> vald_temp = new List<string>();
            if (!(IsUsed && (Action == "C" || Action == "E")))
            {
                //if (TEC_Description_ZH.Visible && TEC_Description_ZH.Enabled && Util.TextLength(mt.TEC_Description_ZH == null ? "" : mt.TEC_Description_ZH) > 40)
                //{
                //    vald_temp.Add(Sheet + "Description 1 (ZH.)长度大于40个字符");
                //}

                //if (TEC_Density_L.Visible && TEC_Density.Enabled && !string.IsNullOrEmpty(mt.TEC_Density))
                //{
                //    vald_temp.AddRange(Validation(RegularExp.Digit3, new Regular(mt.TEC_Density, Sheet + "Density不超过三位小数")));
                //}

                return vald_temp;
            }

            List<Regular> regs = new List<Regular>();
            switch (Category)
            {
                case "SEFI":
                    if (TaskAPI.Process != "TW MTO Application-DECO" && TaskAPI.Process != "TW MTO Application-PKG" && TaskAPI.Process != "Sefi Code Application" && TaskAPI.Process != "TW SEFI Code Application")
                    {
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZH.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Color_Code_L, mt.TEC_Color_Code, Sheet + "Color Code为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Pack_Size_L, mt.TEC_Pack_Size, Sheet + "Pack Size为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_QM_L, mt.TEC_QM, Sheet + "QM(Y/N)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Lab_Office_L, mt.TEC_Lab_Office, Sheet + "Lab/Office为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Relabel_L, mt.TEC_Relabel, Sheet + "是否Relabel产品为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_MTO_Code_SEFI_Code_L, mt.TEC_MTO_Code_SEFI_Code, Sheet + "MTO Code(SEFI Code)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Inspection_Setup_L, mt.TEC_Inspection_Setup, Sheet + "Inspection Setup为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SAP_IP_Group_L, mt.TEC_SAP_IP_Group, Sheet + "SAP IP Group为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Subline_L, mt.TEC_Subline, Sheet + "Subline为必填");
                    }
                    if (TaskAPI.Process == "Sefi Code Application" && FORM == "FORM-005")
                    {
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZH.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Lab_Office_L, mt.TEC_Lab_Office, Sheet + "Lab/Office为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Top_Sefi_L, mt.TEC_Top_Sefi, Sheet + "Top Sefi为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Inspection_Setup_L, mt.TEC_Inspection_Setup, Sheet + "Inspection Setup为必填");

                    }
                    if (TEC_Description_ZH.Visible && TEC_Description_ZH.Enabled && Util.TextLength(mt.TEC_Description_ZH == null ? "" : mt.TEC_Description_ZH) > 40)
                    {
                        vald_temp.Add(Sheet + "Description 1 (ZH.)长度大于40个字符");
                    }
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Lab_Office_L, mt.TEC_Lab_Office, Sheet + "Lab/Office为必填");
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density为必填");
                    //if (TEC_Density_L.Visible && TEC_Density.Enabled && !string.IsNullOrEmpty(TEC_Density.Text))
                    if (!string.IsNullOrEmpty(TEC_Density.Text))
                    {
                        regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Density, Sheet + "Density不超过三位小数"));
                    }
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code为必填");
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_MTO_Code_SEFI_Code_L, mt.TEC_MTO_Code_SEFI_Code, Sheet + "MTO Code(SEFI Code)为必填");
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Inspection_Setup_L, mt.TEC_Inspection_Setup, Sheet + "Inspection Setup为必填");
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SAP_IP_Group_L, mt.TEC_SAP_IP_Group, Sheet + "SAP IP Group为必填");
                    //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Subline_L, mt.TEC_Subline, Sheet + "Subline为必填");
                    if (TaskAPI.Process == "PKG Sefi Code BOM Application" && !(Page as PMDC).Code_Selected.Checked)
                    {
                        return vald_temp;
                    }
                    if (FORM == "FORM-T008" || TaskAPI.Process == "TW MTO Application-DECO")
                    {
                        
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code(Old Material Code)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF)爲必填");
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Top_Sefi_L, mt.TEC_Top_Sefi, Sheet + " Top Sefi(Y/N)爲必選");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume爲必填");
                        
                    }
                    if (FORM == "FORM-T011" || TaskAPI.Process == "TW MTO Application-PKG")
                    {

                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code(Old Material Code)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF)爲必填");
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Top_Sefi_L, mt.TEC_Top_Sefi, Sheet + " Top Sefi(Y/N)爲必選");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume爲必填");

                    }
                    if (FORM == "FORM-T007" && this.TEC_Top_Sefi_L.Visible && this.TEC_Volume_L.Visible)
                    {
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Top_Sefi_L, mt.TEC_Top_Sefi, Sheet + " Top Sefi(Y/N)爲必選");
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code(Old Material Code)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume爲必填");
                    }
                    if (FORM == "FORM-T011-1" && this.TEC_Top_Sefi_L.Visible && this.TEC_Volume_L.Visible)
                    {
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Top_Sefi_L, mt.TEC_Top_Sefi, Sheet + " Top Sefi(Y/N)爲必選");
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code(Old Material Code)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF)爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density爲必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume爲必填");
                    }
                    break;
                case "RAW":
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Plant_L, mt.TEC_Plant, Sheet + "Plant为必填");
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_A_Coat_L, mt.TEC_A_Coat, Sheet + "A-Coat为必填");
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN.)为必填");
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZH.)为必填");
                    if (TEC_Description_ZH.Visible && TEC_Description_ZH.Enabled && Util.TextLength(mt.TEC_Description_ZH == null ? "" : mt.TEC_Description_ZH) > 40)
                    {
                        vald_temp.Add(Sheet + "Description 1 (ZH.)长度大于40个字符");
                    }
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Lab_Office_L, mt.TEC_Lab_Office, Sheet + "Lab/Office为必填");
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density为必填");
                    if (TEC_Density_L.Visible && TEC_Density.Enabled && !string.IsNullOrEmpty(mt.TEC_Density))
                    {
                        regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Density, Sheet + "Density不超过三位小数"));
                    }
                    akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Inspection_Setup_L, mt.TEC_Inspection_Setup, Sheet + "Inspection setup为必填");
                    break;

                case "PACK":
                    break;

                case "FINI":
                    if (TaskAPI.Process == "NPL Master Data Application" && false ) { }
                    else
                    {
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Density_L, mt.TEC_Density, Sheet + "Density为必填");
                        if (TEC_Density_L.Visible && TEC_Density.Enabled && !string.IsNullOrEmpty(mt.TEC_Density))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Density, Sheet + "Density不超过三位小数"));
                        }
                    }
                    if (TaskAPI.Process == "PKG Fini Code BOM Application")
                    {
                        if (!(Page as PMDC).Code_Selected.Checked)
                        {
                            return vald_temp;
                        }
                    }
                    //if (TaskAPI.Process == "TW New Raw Material Creation")
                    //{

                    
                    //}
                    if (FORM == "FORM-TW-003")
                    {
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                        }
                        else
                        {
                            akzo_RegularCheck(ref regs, RegularExp.Digit3, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume不超過三位小數必填");
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Plant_L, mt.TEC_Plant, Sheet + "Plant为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_A_Coat_L, mt.TEC_A_Coat, Sheet + "A-Coat为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Lab_Office_1_L, mt.TEC_Lab_Office_1, Sheet + "Lab/Office 必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Active_L, mt.TEC_Active, Sheet + "Active 必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Material_Group_L, mt.TEC_Material_Group, Sheet + "Material Group 为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Unit_Of_Measure_Y_L, mt.TEC_Unit_Of_Measure_Y, Sheet + "Numerator 为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Storage_Location_L, mt.TEC_Storage_Location, Sheet + "Storage Location必填");

                    }
                    if (FORM == "FORM-TW-011" || FORM == "FORM-TW-007-1")
                    {
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                            regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                        }
                        else
                        {
                            akzo_RegularCheck(ref regs, RegularExp.Digit3, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume 必填 不超過三位小數");
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Profit_Center_L, mt.TEC_Profit_Center, Sheet + "Profit Center 为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_SEFI_Code_L, mt.TEC_SEFI_Code, Sheet + "SEFI Code(Old Material Code) 为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Top_Sefi_L, mt.TEC_Top_Sefi, Sheet + "Top Sefi(Y/N)? 为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF.)为必填");
                        if (TEC_Unit_Of_Measure_Y_L.Visible && TEC_Unit_Of_Measure_Y_L.Enabled && !string.IsNullOrEmpty(mt.TEC_Unit_Of_Measure_Y))
                        {
                            regs.Add(new Regular(RegularExp.Integer, mt.TEC_Unit_Of_Measure_Y, Sheet + "Numerator 只能爲整數"));
                        }
                        else
                        {
                            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Unit_Of_Measure_Y_L, mt.TEC_Unit_Of_Measure_Y, Sheet + "Numerator 必填");
                        }
                    }
                   
                    if (FORM == "FORM-TW-004")
                    {
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_A_Coat_L, mt.TEC_A_Coat, Sheet + "SAP Code 为必填");
                        if (TEC_Volume_L.Visible && TEC_Volume.Enabled && !string.IsNullOrEmpty(mt.TEC_Volume))
                        {
                             regs.Add(new Regular(RegularExp.Digit3, mt.TEC_Volume, Sheet + "Volume不超過三位小數"));
                           
                        }
                        else
                        {
                            akzo_RegularCheck(ref regs, RegularExp.Digit3, TEC_Volume_L, mt.TEC_Volume, Sheet + "Volume不超過三位小數必填");
                        }
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_EN_L, mt.TEC_Description_EN, Sheet + "Description 1 (EN.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Description_ZH_L, mt.TEC_Description_ZH, Sheet + "Description 2 (ZF.)为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Active_L, mt.TEC_Active, Sheet + "Active 必填");
                        //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Material_Group_L, mt.TEC_Material_Group, Sheet + "Material Group 为必填");
                        akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Material_Group_L, mt.TEC_Material_Group, Sheet + "Material Group 为必填");
                    }
                    if (FORM == "FORM-T003" && (Page as PMDC).rd_Raw_Code.SelectedValue == "0")
                    {
                        if (TEC_Active.Visible)
                        {
                            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, TEC_Active_L, mt.TEC_Active, Sheet + "Active 必填");
                        }
                    }
                    break;
            }

            List<string> vald_s = Validation(regs);
            vald_s.AddRange(vald_temp);

            return vald_s;
        }
        #endregion

        #region QM
        protected void TEC_QM_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (FORM == "FORM-036" && TEC_QM.SelectedValue == "N")
            {
                TEC_Active.SelectedValue = "";
                SetEnable(false, TEC_Active);
                SetForeColor(Color.Orange, TEC_Active_L);
            }
            else
            {
                SetEnable(true, TEC_Active);
                SetForeColor(Color.Blue, TEC_Active_L);
            }
        }
        #endregion

        #region Top Sefi
        protected void TEC_Top_Sefi_SelectedIndexChanged(object sender, EventArgs e)
        {
            //if (FORM == "FORM-TW-007-1" || FORM == "FORM-T011" || FORM == "FORM-T008" || FORM == "FORM-TW-011")
            if (TaskAPI.Process == "TW NPL Application-DECO" || TaskAPI.Process == "TW MTO Application-PKG" || TaskAPI.Process == "TW MTO Application-DECO" || TaskAPI.Process == "TW NPL Application-PKG")
            {
                if (TEC_Top_Sefi.SelectedValue == "Y")
                {
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "ESO";
                    if (TaskAPI.Process != "TW NPL Application-PKG")
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Type.Text = "M0";
                }
                else if (TEC_Top_Sefi.SelectedValue == "N")
                {
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "ESL";
                    if (TaskAPI.Process != "TW NPL Application-PKG")
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Type.Text = "PD";
                }
                else
                {
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Type.Text = "";
                } 
            }
            if (TaskAPI.Process == "TW SEFI Code Application")
            {
                if (TEC_Top_Sefi.SelectedValue == "Y")
                {
                    (Page as PMDC).TabMaterial1.Planning1.PLA_MRP_Type.Text = "M0";
                    (Page as PMDC).TabMaterial1.Planning1.PLA_MRP_Controller.Text = "ESP";
                    //(Page as PMDC).TabMaterial1.Planning1.PLA_Availability_Check.Text = "KP";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Type.Text = "M0";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "ESP";
                    (Page as PMDC).TabMaterial1.Planning1.PLA_Backflush.Text = "";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_Backflush.Text = "";
                    //(Page as PMDC).TabMaterial2.Planning1.PLA_Availability_Check.Text = "KP";
                }
                else if (TEC_Top_Sefi.SelectedValue == "N")
                {

                    (Page as PMDC).TabMaterial1.Planning1.PLA_MRP_Type.Text = "PD";
                    (Page as PMDC).TabMaterial1.Planning1.PLA_MRP_Controller.Text = "ESL";
                    //(Page as PMDC).TabMaterial1.Planning1.PLA_Availability_Check.Text = "Z1";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Type.Text = "PD";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "ESL";
                    (Page as PMDC).TabMaterial1.Planning1.PLA_Backflush.Text = "1";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_Backflush.Text = "1";
                    //(Page as PMDC).TabMaterial2.Planning1.PLA_Availability_Check.Text = "Z1";
                }
                else
                {
                    (Page as PMDC).TabMaterial1.Planning1.PLA_MRP_Type.Text = "";
                    (Page as PMDC).TabMaterial1.Planning1.PLA_MRP_Controller.Text = "";
                    //(Page as PMDC).TabMaterial1.Planning1.PLA_Availability_Check.Text = "KP";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Type.Text = "";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_MRP_Controller.Text = "";
                    (Page as PMDC).TabMaterial1.Planning1.PLA_Backflush.Text = "";
                    (Page as PMDC).TabMaterial2.Planning1.PLA_Backflush.Text = "";
                    //(Page as PMDC).TabMaterial2.Planning1.PLA_Availability_Check.Text = "KP";
                } 
            }
           
        }
        #endregion
    }
}
